package com.yaorange.teaching.mapper;

import java.util.List;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yaorange.teaching.domain.YaCourseDesign;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 课程设计Mapper接口
 *
 * @author ruoyi
 * @date 2024-11-16
 */
public interface YaCourseDesignMapper extends BaseMapper<YaCourseDesign>
{
    /**
     * 查询课程设计
     *
     * @param id 课程设计主键
     * @return 课程设计
     */
    public YaCourseDesign selectYaCourseDesignById(Long id);

    /**
     * 查询课程设计列表
     *
     * @param yaCourseDesign 课程设计
     * @return 课程设计集合
     */
    public List<YaCourseDesign> selectYaCourseDesignList(YaCourseDesign yaCourseDesign);

    /**
     * 新增课程设计
     *
     * @param yaCourseDesign 课程设计
     * @return 结果
     */
    public int insertYaCourseDesign(YaCourseDesign yaCourseDesign);

    /**
     * 修改课程设计
     *
     * @param yaCourseDesign 课程设计
     * @return 结果
     */
    public int updateYaCourseDesign(YaCourseDesign yaCourseDesign);

    /**
     * 删除课程设计
     *
     * @param id 课程设计主键
     * @return 结果
     */
    public int deleteYaCourseDesignById(Long id);

    /**
     * 批量删除课程设计
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteYaCourseDesignByIds(Long[] ids);

    @Select("select * from ya_course_design where stage = #{stageId}")
    List<YaCourseDesign> selectYaCourseDesignListByStageId(@Param("stageId") Long stageId);

    void deleteYaCourseDesignByIdsNotIn(@Param("idsList") List<Long> idsList);

    @Delete("delete from ya_course_design_interview where cd_id = #{cdId}")
    void deleteRelatedInterview(@Param("cdId")Integer cdId);

    @Insert("insert into ya_course_design_interview(cd_id,interview_id) values(#{cdId},#{interviewId}) ")
    void insertCourseDesignInterview(@Param("cdId")Integer cdId, @Param("interviewId")Integer interviewId);
}
